package com.library.service.impl;

import java.util.List;

import com.library.bean.Book;
import com.library.bean.Page;
import com.library.dao.BookDao;
import com.library.dao.impl.BookDaoImpl;
import com.library.service.BookService;

public class BookServiceImpl implements BookService {
	private BookDao bookDao = new BookDaoImpl();

	@Override
	public Page<Book> getBookAll(int pageNum ,int pageSize ,String bookId , String bookNo,String bookName,String bookWriter,double minBookPrice,double maxBookPrice,String bookType) {
		List<Book> list = bookDao.selectBookAll(pageNum, pageSize, bookId, bookNo, bookName, bookWriter, minBookPrice, maxBookPrice, bookType); 
		int rows = bookDao.bookTotalRows(bookId, bookNo, bookName, bookWriter, minBookPrice, maxBookPrice, bookType);
		Page<Book> page = new Page<Book>(list, pageNum, pageSize, rows);
		return page;
	}

	@Override
	public int deleteBookByBookId(int bookId) {
		return bookDao.deleteBookByBookId(bookId);
	}

}
